﻿namespace Sgr.AuditLogs.Services
{
    public class OperationStatistics
    {
        /// <summary>
        /// 操作总次数
        /// </summary>
        public int TotalOperations { get; set; }

        /// <summary>
        /// 失败次数
        /// </summary>
        public int FailedOperations { get; set; }

        /// <summary>
        /// 成功率（百分比），如98.5表示98.5%
        /// </summary>
        public double SuccessRate => TotalOperations > 0
            ? Math.Round((double)(Math.Min(TotalOperations - FailedOperations, 0)) * 100.0 / TotalOperations, 2)
            : 0;
    }
}